import Vue from 'vue'
import VueRouter from 'vue-router'
import VueResource from 'vue-resource'
import App from './App.vue'
// from里边的.vue可以省略，程序会自动配置补全
import goods from './components/goods/goods.vue'
import ratings from './components/ratings/ratings'
import seller from './components/seller/seller'

import './cube-ui'
import './common/stylus/index.styl'

Vue.config.productionTip = false
// 设置为 false 以阻止 vue 在启动时生成生产提示。
Vue.use(VueRouter)
Vue.use(VueResource)

// 定义路由
const routes = [
  {
    name: 'goods',
    path: '/goods',
    component: goods
  },
  {
    name: 'ratings',
    path: '/ratings',
    component: ratings
  },
  {
    name: 'seller',
    path: '/seller',
    component: seller
  },
  {
    path: '/',
    redirect: '/goods'
  }
]

// 创建路由实例，实例化router
const router = new VueRouter({
  routes,
  linkActiveClass: 'active'
  // linkActiveClass: 'active' 是改变了路由被选中时默认添加的class样式名
})

// 创建Vue的实例，并挂载
// 这里挂载到了index.html里的<div id="app"></div>
new Vue({
  render: h => h(App),
  router
}).$mount('#app')
